package cn.yuanqiao.web.controller.archive.appManager;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.yuanqiao.common.annotation.Log;
import cn.yuanqiao.common.enums.BusinessType;

import cn.yuanqiao.archive.appManager.domain.YqWhzrz;
import cn.yuanqiao.archive.appManager.service.IYqWhzrzService;
import cn.yuanqiao.common.web.controller.BaseController;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.utils.poi.ExcelUtil;
import cn.yuanqiao.common.web.page.TableDataInfo;

/**
 * 文号责任者Controller
 * 
 * @author sy
 * @date 2023-09-12
 */
@RestController
@RequestMapping("/archive/yqwhzrz")
public class YqWhzrzController extends BaseController
{
    @Autowired
    private IYqWhzrzService yqWhzrzService;

    /**
     * 查询文号责任者列表
     */
    @PreAuthorize("@ss.hasPermi('archive:yqwhzrz:list')")
    @GetMapping("/list")
    public TableDataInfo list(YqWhzrz yqWhzrz)
    {
        startPage();
        List<YqWhzrz> list = yqWhzrzService.selectYqWhzrzList(yqWhzrz);
        return getDataTable(list);
    }

    /**
     * 导出文号责任者列表
     */
//    @PreAuthorize("@ss.hasPermi('archive:yqwhzrz:export')")
//    @Log(title = "文号责任者", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, YqWhzrz yqWhzrz)
//    {
//        List<YqWhzrz> list = yqWhzrzService.selectYqWhzrzList(yqWhzrz);
//        ExcelUtil<YqWhzrz> util = new ExcelUtil<YqWhzrz>(YqWhzrz.class);
//        util.exportExcel(response, list, "文号责任者数据");
//    }

    /**
     * 获取文号责任者详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:yqwhzrz:query')")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") Long ID)
    {
        return success(yqWhzrzService.selectYqWhzrzByID(ID));
    }

    /**
     * 新增文号责任者
     */
    @PreAuthorize("@ss.hasPermi('archive:yqwhzrz:add')")
    @Log(title = "文号责任者", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YqWhzrz yqWhzrz)
    {
        return success(yqWhzrzService.insertYqWhzrz(yqWhzrz));
    }

    /**
     * 修改文号责任者
     */
    @PreAuthorize("@ss.hasPermi('archive:yqwhzrz:edit')")
    @Log(title = "文号责任者", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YqWhzrz yqWhzrz)
    {
        return success(yqWhzrzService.updateYqWhzrz(yqWhzrz));
    }

    /**
     * 删除文号责任者
     */
    @PreAuthorize("@ss.hasPermi('archive:yqwhzrz:remove')")
    @Log(title = "文号责任者", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable Long[] IDs)
    {
        return toAjax(yqWhzrzService.deleteYqWhzrzByIDs(IDs));
    }
}
